# Recipe file for guile.
#
# Maintainers: (C) 2017 Mateus P. Rodrigues, mprodrigues@dragora.org.
#
# Under the terms of the GNU General Public License.

program=guile
version=2.2.2
release=1

description="
GNU Guile is the preferred extension system for the GNU Project.

Guile is an implementation of the Scheme programming language, supporting the
Revised5 and most of the Revised6 language reports, as well as many SRFIs. It
also comes with a library of modules that offer additional features, like an
HTTP server and client, XML parsing, and object-oriented programming.
"

homepage=https://www.gnu.org/software/guile/
license=LGPL

tarname=${program}-${version}.tar.lz

# Remote source(s)
fetch="https://ftp.gnu.org/gnu/guile/${tarname}"

# Source documentation
docs="ABOUT-NLS AUTHORS COPYING* ChangeLog* GUILE-VERSION HACKING LICENSE NEWS README THANKS TODO"

build() {
    unpack "${tardir}/$tarname"

    cd "$srcdir"

    ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
    $configure_args \
    --libdir=/usr/lib${libSuffix} \
    --infodir=$infodir \
    --mandir=$mandir \
    --docdir=$docdir \
    --build="$(cc -dumpmachine)"

    make -j${jobs}
    make -j${jobs} install DESTDIR="$destdir"

    # Delete index file for the package
    if test -d "${destdir}/$infodir"
    then
        rm -f "${destdir}/${infodir}/dir"
    fi

    # Copy documentation
    mkdir -p "${destdir}/usr/local/share/doc/${program}-${version}"
    cp -p $docs "${destdir}/usr/local/share/doc/${program}-${version}/"
}
